﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;

namespace Apewer.Web
{

    /// <summary>程序集资源。</summary>
    public static class Resources
    {

        static byte[] Bytes(string name)
        {
            var assembly = Assembly.GetExecutingAssembly();
            using (var stream = assembly.GetManifestResourceStream(name)) return stream.Read();
        }

        static string Text(string name) => BytesUtility.WipeTextBom(Bytes(name)).Text();

        /// <summary>获取预置的 favicon.ico 文件，。</summary>
        public static byte[] FavIcon() => Bytes("Apewer.FavIcon.ico");

        /// <summary>获取用于 .NET Framework 4.0 的 web.config 文件。</summary>
        public static string WebConfig40() => Text("Apewer.WebConfig40.xml");

        /// <summary>获取用于 .NET Framework 4.6.1 的 web.config 文件。</summary>
        public static string WebConfig461(bool netstandard = false) => Text(netstandard ? "Apewer.WebConfigStd.xml" : "Apewer.WebConfig461.xml");
    }

}
